// pages/index/index/index.js
Page({
    data:{
        textArr:[],//文章列表
        pageNum:1,
        pageSize:3,
        hasMore: true, // 是否还有更多数据可加载
        url:'',
        losthost:''
      },
      onLoad(options) {
        const app = getApp();
        this.setData({
            url: app.globalData.URL,
            losthost:app.globalData.losthost
        })
        console.log(this.data.url)
        console.log(this.data.losthost)
        this.gettextlist(); // 调用加载音频列表的方法
      },
      gettextlist(){
          wx.request({
            url: this.data.url+"article",
            method: 'GET',
            data:{
                pageNum: this.data.pageNum,
                pageSize: this.data.pageSize
            },
            success:(res)=>{
                console.log("res",res.data.data)
                this.setData({
                    textArr:res.data.data.list
                })
                console.log("textArr",this.data.textArr)
            },
            fail:(err)=>{
                wx.showToast({
                    title: '加载音频列表失败',
                    icon: 'none'
                  });
                  console.log('Failed to fetch audio list from server:', err);
            }
          })
      },
  goRaiseQ(){
    wx.navigateTo({
      url: '../mindAnwser/raiseQ/raiseQ',
    })
  },
  more_text1(){
    wx.navigateTo({
      url: '/pages/index/article/article',
    })
  },
  toMoreDetil(event) {
    const index = event.currentTarget.dataset.index;
    const id = this.data.textArr[index].id; 
    wx.navigateTo({
      url: '../article/articledetail/articledetail?id='+id, // 跳转到详情页面
    });
    // 在这里实现跳转逻辑
  }
  
})